package day03;

import java.util.ArrayList;
import java.util.Collections;

public class OperDemo {
    public static void main(String[] args) {
/*        System.out.println(5 % 2);
        System.out.println(8 % 2);
        System.out.println(2 % 8);

        int a = 5, b = 5;
        a++;
        ++b;
        System.out.println(a);
        System.out.println(b);


        int a1 = 5, b1 = 5;
        a1--;
        --b1;
        System.out.println(a1);
        System.out.println(b1);

        //被使用----自增
        int a2 = 5, b2 = 5;
        int c = a2++; //1)将a++的值5赋值给c  2)a自增1变为6
        int d = ++b2; //1)将++b的值6赋值给d  2)b自增1变为6
        System.out.println(a2); //6
        System.out.println(b2); //6
        System.out.println(c); //5
        System.out.println(d); //6

        //被使用----自减
        int a3 = 5, b3 = 5;
        int c2 = a3--; //1)将a--的值5赋值给c  2)a自减1变为4
        int d2 = --b3; //1)将--b的值4赋值为d  2)b自减1变为4
        System.out.println(a3); //4
        System.out.println(b3); //4
        System.out.println(c2); //5
        System.out.println(d2); //4
        */
 /*       int a=5,b=10,c=5;
        boolean b1 = b>a;
        System.out.println(b1);   //true
        System.out.println(c<b);  //true
        System.out.println(a>=c); //true
        System.out.println(b<=a); //false
        System.out.println(b==c); //false
        System.out.println(a!=c); //false

        System.out.println(a+c>10); //false
        System.out.println(b%2==0); //true
        System.out.println(c++>5);  //false------c自增1变为6
        System.out.println(c++>5);  //true-------c自增1变为7*/

/*        int a=5,b=10,c=5;
        boolean b1 = b>=a && b<c;
        System.out.println(b1);          //true&&false=false
        System.out.println(b<=c && b>a); //false&&true=false
        System.out.println(a==b && c>b); //false&&false=false
        System.out.println(b!=c && a<b); //true&&true=true

        System.out.println(b>=a || b<c); //true||false=true
        System.out.println(b<=c || b>a); //false||true=true
        System.out.println(b!=c || a<b); //true||true=true
        System.out.println(a==b || c>b); //false||false=false

        boolean b2 = !(a<b);
        System.out.println(b2);     //!true=false
        System.out.println(!(a>b)); //!false=true*/
/*
        int a=5,b=10,c=5;
        boolean b3 = a>b && c++>2;
        System.out.println(b3); //false
        System.out.println(c);  //5，发生短路了

        //演示||的短路
        boolean b4 = a<b || c++>2;
        System.out.println(b4); //true
        System.out.println(c);  //5，发生短路了*/


 /*       int a = 5;
        a += 10; //相当于a=(int)(a+10)
        System.out.println(a); //15
        a *= 2; //相当于a=(int)(a*2)
        System.out.println(a); //30
        a /= 6; //相当于a=(int)(a/6)
        System.out.println(a); //5

        short s = 5;
        //s = s+10; //编译错误，需强转，改为: s=(short)(s+10);
        s += 10; //相当于s=(short)(s+10)*/

        //演示同化作用
        System.out.println(10+20+""+30); //3030---------String
        System.out.println(""+10+20+30); //102030-------String
        System.out.println(10+20+30+""); //60-----------String
    }
}
